<?php
/**
 * Created by PhpStorm.
 * User: xiaoda
 * Date: 2017/4/13
 * Time: 11:06
 */

namespace crontab;

use App\Models\Agent;
use App\Models\Answer;
use App\Models\Level;
use App\Models\Profile;
use common\services\UserLogsService;
use common\utils\RedisKeys;
use common\utils\SysCode;
use Illuminate\Support\Facades\Redis;


class UserProcessor
{

    public function __construct()
    {
        Log::info("UserProcessor Strated");
    }

    //注册成功记录日志(各种用户操作日志登录、注册)
    public function userLog()
    {
        $redis = Redis::connection();
        $data = $redis->lPop(RedisKeys::USER_OPT_LOG);//移出并获取列表的第一个元素

        if ($data) {
            $data = json_decode($data, true);
            UserLogsService::saveLog($data);
        }
    }

    public function handle()
    {
        $this->userLog();
    }

}